package com.lmk.work;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class Read {
    public static void main(String[] args) {
        String  path="D:/11/a/test.txt";
        //1.创建文件对象
        File file=new File(path);
        //2.定义输入流
        try(InputStream OS=new FileInputStream(file)){
            byte[] bytes=new byte[(int) file.length()];
            OS.read(bytes);
            String str=new String(bytes);
            System.out.println(str);

        }catch (Exception e){
            e.printStackTrace();
        }

    }
    }

